package lib.quasar.widget.arrow;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

import lib.quasar.util.DimenUtil;
import lib.quasar.util.LogUtil;
import lib.quasar.widget.R;
import lib.quasar.widget.paint.PaintManager;

public class ArrowView extends View {

    private final float mArrowLeft = DimenUtil.dp2px(21f);
    private final float mArrowRight = DimenUtil.dp2px(30f);
    private final float mArrowHeight = DimenUtil.dp2px(8f);

    final Paint paint1 = PaintManager.getLinePaint(Color.GRAY, PaintManager.LiNE_ARROW);
    final Path path = new Path();

    public ArrowView(Context context) {
        super(context);
    }

    public ArrowView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void draw(Canvas canvas) {
        super.draw(canvas);

        path.moveTo(mArrowRight, getHeight() * 0.5f - mArrowHeight);
        path.lineTo(mArrowLeft, getHeight() * 0.5f);
        path.lineTo(mArrowRight, getHeight() * 0.5f + mArrowHeight);
        canvas.drawPath(path, paint1);
    }
}
